package com.lt.service.impl;

import com.lt.dao.MedicineDao;
import com.lt.entity.Medicine;
import com.lt.service.MedicineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicineServiceImpl implements MedicineService {

    @Autowired
    private MedicineDao medicineDao;

    @Override
    public boolean save(Medicine medicine) {
        return medicineDao.save(medicine) > 0;
    }

    @Override
    public boolean deleteById(Integer id) {
        return medicineDao.deleteById(id) > 0;
    }

    @Override
    public boolean update(Medicine medicine) {
        return medicineDao.update(medicine) > 0;
    }

    @Override
    public List<Medicine> getAll() {
        return medicineDao.getAll();
    }

    @Override
    public Medicine getById(Integer id) {
        return medicineDao.getById(id);
    }
}
